#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2e5 + 10;
int n, k;
ll a[N];

bool check(ll p) {
    ll sum = 0;
    for (int i = 1; i <= n; i++) sum += min(a[i], p);

    return p*k > sum;
}

int main() {
    cin >> n >> k;

    for (int i = 1; i <= n; i++) cin >> a[i];

    ll l = 0, r = 1e18 / k;

    while (l < r) {
        ll mid = (l+r+1ll) >> 1;
        // P*K > sum
        if (check(mid)) r = mid-1;
        else l = mid;
    }
    cout << l << endl;
    return 0;
}